<template>
	<view class="">
		<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :back-top="true">
			<view class="" style="padding: 20rpx;">
			   <item-list :isStore="true" :list="dataList"></item-list>
			</view>
		</s-pull-scroll>
		<mix-loading v-if="isLoading"></mix-loading>
	</view>
</template>

<script>
	import itemList from "@/components/page-item-list/index-item.vue"
	export default {
		components:{
			itemList
		},
		data(){
			return{
				dataList:[],
				point:uni.getStorageSync('point')
			}
		},
		onLoad() {
			this.refresh();
		},
		methods:{
			pullDown(pullScroll) {
				setTimeout(() => {
					this.loadData(pullScroll);
				}, 200);
			},
			async loadData(pullScroll) {
				const data = {
					longitude:this.point.longitude,
					latitude:this.point.latitude,
					uid: uni.getStorageSync('uid'),
					pageNo: pullScroll.page,
					pageSize: '10'
				};
				if (pullScroll.page == 1) this.dataList = [];
				const res = await this.$request('recharge/list-collect', data, { showLoading: true });
				if (res.result == 0) {
					res.data.list.forEach(el=>{
						this.$set(el,'labelList',[])
						if(el.lable && el.lable.icon && el.lable.id && el.lable.content){
							let icon = el.lable.icon.split(',')
							let id = el.lable.id.split(',')
							let content = el.lable.content.split(',')
							for(var i = 0; i < id.length; i++){
								el.labelList.push({
									icon:icon[i],
									id:id[i],
									content:content[i]
								})
							}
						}
					})
					this.dataList = this.dataList.concat(res.data.list);
					pullScroll.endByPage(Math.ceil(res.data.count / 10), res.data.list);
				} else {
					this.$util.msg(res.resultNote);
				}
			}
		}
	}
</script>

<style>
</style>
